<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('基站管理列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>基站ID：</label>
                                <input type="text" name="locatorId"/>
                            </li>
                            <li>
                                <label>设备名称：</label>
                                <input type="text" name="locatorName"/>
                            </li>
                            <li>
                                <label>设备型号：</label>
                                <input type="text" name="modelId"/>
                            </li>
                            <li>
                                <label>楼层：</label>
                                <input type="text" name="fnum"/>
                            </li>
                            <li>
                                <label>在线情况：</label>
                                <select name="isOnline" th:with="type=${@dict.getType('sys_is_online')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>是否使用：</label>
                                <select name="isUse" th:with="type=${@dict.getType('sys_is_use')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:locator:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:locator:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:locator:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:locator:export">
                    <i class="fa fa-download"></i> 导出
                </a>
<!--                <a class="btn btn-primary single disabled" onclick="rpcDown()" shiro:hasPermission="system:locator:remove">-->
<!--                    <i class="fa fa-download"></i> 下发-->
<!--                </a>-->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:locator:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:locator:remove')}]];
        var isOnlineDatas = [[${@dict.getType('sys_is_online')}]];
        var isUseDatas = [[${@dict.getType('sys_is_use')}]];
        var prefix = ctx + "system/locator";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "基站管理",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'locatorId',
                    title: '基站ID'
                },
                {
                    field: 'locatorName',
                    title: '设备名称'
                },
                {
                    field: 'modelId',
                    title: '设备型号'
                },
                {
                    field: 'coordinate',
                    title: '坐标'
                },
                {
                    field: 'toCoordinate',
                    title: '指向坐标'
                },
                {
                    field: 'height',
                    title: '高度'
                },
                {
                    field: 'fnum',
                    title: '楼层'
                },
                {
                    field: 'isOnline',
                    title: '在线情况',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(isOnlineDatas, value);
                    }
                },
                {
                    field: 'isUse',
                    title: '是否使用',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(isUseDatas, value);
                    }
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="openMap(\'' + row.id + '\')"><i class="fa fa-edit"></i>坐标设置</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        actions.push('<a class="btn btn-info btn-xs' + editFlag + '" href="javascript:void(0)" onclick="authTag(\'' + row.id + '\')"><i class="fa fa-user"></i>分配标签</a>');

                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        /* 分配标签 */
        function authTag(locatorId) {
            var url = prefix + '/authTag/' + locatorId;
            $.modal.openTab("分配标签", url);
        }
        function openMap(id){
            // $.modal.openTab("基站坐标设置" + locatorId);
            $.modal.open("基站坐标设置", prefix+"/locatorCoordinate/"+id);
        }
    </script>
</body>
</html>